<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        div {
            width: 430px;
            border: 1px solid #000;
            box-sizing: border-box;
            margin: 100px auto;
        }

        ul {
            list-style: none;
            width: 100%;
            display: flex;
            justify-content: space-between;
        }

        ul>li {
            border: 2px solid transparent;
            box-sizing: border-box;
        }

        ul>li>img {
            width: 80px;
            height: 80px;
        }

        .current {
            border-color: skyblue;
        }
    </style>
</head>

<body>
    <div>
        <img src="./images/pic1.jpg" alt="">
        <ul>
            <li><img src="./images/pic1.jpg" alt=""></li>
            <li><img src="./images/pic2.jpg" alt=""></li>
            <li><img src="./images/pic3.jpg" alt=""></li>
            <li><img src="./images/pic4.jpg" alt=""></li>
            <li><img src="./images/pic5.jpg" alt=""></li>
        </ul>
    </div>
    <script>
        let lis = document.querySelectorAll('li'),
            img = document.querySelector('img');
        for (const value of lis) {
            value.addEventListener(
                'mouseenter',
                function () {
                    this.className = 'current';
                    img.src = this.firstElementChild.src;
                },
                false
            );
            value.addEventListener(
                'mouseleave',
                function () {
                    this.className = '';
                },
                false
            );
        }

    </script>
</body>

</html>